import request from '@/config/axios'

export interface TagVO {
  id: number
  tagName: string
  siteId: number
  userId: number
}

export interface TagPageReqVO extends PageParam {
  tagName?: string
  siteId?: number
  userId?: number
  createTime?: Date[]
}

export interface TagExcelReqVO {
  tagName?: string
  siteId?: number
  userId?: number
  createTime?: Date[]
}

// 查询tag词列表
export const getTagPageApi = async (params: TagPageReqVO) => {
  return await request.get({ url: '/cms/tag/page', params })
}

// 查询tag词详情
export const getTagApi = async (id: number) => {
  return await request.get({ url: '/cms/tag/get?id=' + id })
}

// 新增tag词
export const createTagApi = async (data: TagVO) => {
  return await request.post({ url: '/cms/tag/create', data })
}

// 修改tag词
export const updateTagApi = async (data: TagVO) => {
  return await request.put({ url: '/cms/tag/update', data })
}

// 删除tag词
export const deleteTagApi = async (id: number) => {
  return await request.delete({ url: '/cms/tag/delete?id=' + id })
}

// 导出tag词 Excel
export const exportTagApi = async (params: TagExcelReqVO) => {
  return await request.download({ url: '/cms/tag/export-excel', params })
}
